package com.financing.platform.service.impl;

import java.sql.SQLException;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.financing.platform.dao.IFpShopSubjectUserDao;
import com.financing.platform.dto.FpShopSubjectUserDTO;
import com.financing.platform.service.IFpShopSubjectUserService;

/**
 * fp_shop_subject_user  
 * 用户答题表 业务访问层实现类
 * @author huqiyun
 *
 */
 
@Repository("fpShopSubjectUserService")
public class FpShopSubjectUserServiceImpl extends BaseServiceImpl implements IFpShopSubjectUserService{

	@Autowired
	private IFpShopSubjectUserDao fpShopSubjectUserDao;

	@Override
	public int insert(FpShopSubjectUserDTO fpShopSubjectUser) throws SQLException {
//		DTOdateSetUtil.setCreateInfo(fpShopSubjectUser);
//		DTOdateSetUtil.setUpdateInfo(fpShopSubjectUser);
//		fpShopSubjectUser.setDeleteTag(CommonStatus.DELETE_TAG_NORMAL);
		return fpShopSubjectUserDao.insert(fpShopSubjectUser);
	}

	@Override
	public void update(FpShopSubjectUserDTO fpShopSubjectUser) throws SQLException {
//		DTOdateSetUtil.setUpdateInfo(fpShopSubjectUser);
		fpShopSubjectUserDao.update(fpShopSubjectUser);
	}

	@Override
	public void updateForce(FpShopSubjectUserDTO fpShopSubjectUser) throws SQLException {
//		DTOdateSetUtil.setUpdateInfo(fpShopSubjectUser);
		fpShopSubjectUserDao.updateForce(fpShopSubjectUser);
	}

	@Override
	public void delete(Integer id) throws SQLException {
		fpShopSubjectUserDao.delete(id);
	}
	
	@Override
	public List<FpShopSubjectUserDTO> queryList(FpShopSubjectUserDTO fpShopSubjectUser) throws SQLException {
		return fpShopSubjectUserDao.queryList(fpShopSubjectUser);
	}

	@Override
	public int queryListCount(FpShopSubjectUserDTO fpShopSubjectUser) throws SQLException {
		return fpShopSubjectUserDao.queryListCount(fpShopSubjectUser);
	}

	@Override
	public FpShopSubjectUserDTO loadById(Integer id) throws SQLException {
		return fpShopSubjectUserDao.loadById(id);
	}
 	@Override
	public FpShopSubjectUserDTO queryListGetFirst(FpShopSubjectUserDTO fpShopSubjectUser)
			throws SQLException {
		 List<FpShopSubjectUserDTO> queryList = queryList(fpShopSubjectUser);
		 if(queryList==null||queryList.size()==0){
			 return new FpShopSubjectUserDTO();
		 }
		 return queryList.get(0);
	}
}
